﻿<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page language="java" pageEncoding="UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="apple-itunes-app" content="app-id=591578609">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width"/> 
<meta name="description" content="德瑞姆网校" />
<meta name="keywords" content="德瑞姆网校、心理学、考试"/>

<link rel="icon" href="http://media.yunxuetang.com/OrgFiles/Icons/201310/a103add7-9896-4380-b82e-8cae0ceddd49.ico?r=xwcsshaw" type="image/x-icon" />
<link rel="shortcut icon" href="http://media.yunxuetang.com/OrgFiles/Icons/201310/a103add7-9896-4380-b82e-8cae0ceddd49.ico?r=xwcsshaw" type="image/x-icon" />

<link rel="stylesheet" type="text/css" href="${csspath}/style/style.css">
<link rel="stylesheet" type="text/css" href="${csspath}/style/h_index.css">
<link rel="stylesheet" type="text/css" href="${csspath}/style/home_style.css">
<link rel="stylesheet" type="text/css" href="${csspath}/style/alxx.css">
<link rel="stylesheet" type="text/css" href="${csspath}/style/kczx.css">
<link rel="stylesheet" type="text/css" href="${csspath}/style/zyzx.css">
<link rel="stylesheet" type="text/css" href="${csspath}/style/zyzx_more.css">
<link rel="stylesheet" type="text/css" href="${csspath}/style/tab.css">

<!--[if IE 7]>
<link rel="stylesheet" href="/css/font-awesome/css/font-awesome-ie7.min.css">
<![endif]-->

<script type="text/javascript" src="${csspath}/js/m.js"></script>
<script src="${csspath}/js/jquery.min.js" type="text/javascript"></script>
<script src="${csspath}/js/jquery.slideBox.min.js" type="text/javascript"></script>
<script type="text/javascript" src="${csspath}/js/tabs.js"></script>

<title>德瑞姆家园 </title>

<style type="text/css"> 
a {color:#111;text-decoration:none;} 

a:link{text-decoration:none;}
a:visited{text-decoration:none;}
a:hover{text-decoration:none;}
a:active{text-decoration:none;}
</style> 

</head>
<body style="align:center; padding:0;margin:0;clear:both;">


<!--topNav-->
<div id="topNav">
	<div class="topCont">
		<div class="topCont">
			<a href="#">
          <div class="toplogo"><img src="${imgpath}/images/logo.png"></div></a>
			<ul id="nav01">
				<li><a href="index.htm">首&nbsp;页</a></li>
				<li><a href="news.htm">资&nbsp;讯</a>
					<ul>
						<li><a href="drm_tzgg.htm">通知公告</a></li>
						<li><a href="drm_xydt.htm">学院动态</a></li>
						<li><a href="drm_hydt.htm">行业动态</a></li>
					</ul>
				</li>
				<li><a href="course_center.htm">课&nbsp;程</a>
					<ul>
						<li><a href="course_center.htm">课程中心</a></li>
						<li><a href="public_course.htm">公开课</a></li>
					</ul>
				</li>
				<li><a href="study_resource.htm">资源库</a>
					<ul>
						<li><a href="#">学习资源</a></li>
						<li><a href="case_study.htm">案例库</a></li>
					</ul>
				</li>
				<li><a href="exam_dynamic.htm">考&nbsp;试</a>
					<ul>
						<li><a href="exam_dynamic.htm">考试指南</a></li>
						<li><a href="drm_bkzn.htm">备考指南</a></li>
					</ul>
				</li>
				<li><a href="../home/home/drm_home.htm">家&nbsp;园</a>
					<ul>
						<li><a href="../home/home/drm_home_hy.htm">学员</a></li>
						<li><a href="../home/home/drm_home_hy.htm">讲师</a></li>
						<li><a href="../home/home/drm_home_qz.htm">群组</a></li>
					</ul>
				</li>
			</ul>
			<div class="topnvar"><a href="register.htm">注册</a>/ <a href="login.htm">登陆</a></div>
			<ul id="nav02">
				<li><a href="#">关注我们</a>
					<ul style="height:230px;width:100px;">
						<div class="toper">
							<div class="toper01">
								<p style="text-align:center;">官方新浪微博</p>
								<img class="toper02" src="${imgpath}/images/erwei/sinaweibo.png" ></div>
							<div class="toper01">
								<p style="text-align:center;">官方腾讯微博</p>
								<img class="toper02"src="${imgpath}/images/erwei/tengxunweibo.png" ></div>
							<div class="toper01">
								<p style="text-align:center;">官方微信</p>
								<img class="toper02" src="${imgpath}/images/erwei/weixin.png" ></div>
						</div>
					</ul>
				</li>
			</ul>
			  <div class="gouwu">
			<a href="shop.htm">
			<img src="${imgpath}/images/shopping.png">
			购物车0件</a></div>  
        </div>
		</div>
	</div>

<!--end topNav-->

<div style="height:40px;width:100%;"></div>

<div class="home_divtop01 retext08">

  <!--搜索框-->    
 <div class="so">
<form action="" method="get">
<div class="select_style" >
<select >  
 <option style="text-align:center" value ="全部">全部</option>  
 <option value ="文章">文章</option>  
 <option value="课程">课程</option>  
 <option value="会员">会员</option> 
 <option value="群组">群组</option>  
 <option value="共享">共享</option> 
 <option value="案例">案例</option> 
</select> 
</div>
<div class="kuan" >
<input style="height:25px;" name="" type="text" />
</div>
<div class="an">
<input name="" type="button" />
</div>
</form>
</div>
   <!--搜索按钮--> 
   
 <div class="zxrx" style="top:-5px;">  <img style="text-align:right;" src="${imgpath}/images/zxrx.jpg"></div>
</div>

<div class=""><img src="${imgpath}/images/home_images/home_banner01.jpg"/>
</div>

<div class="zyzx_xx_div">

<div class="zyzx_more_divt01" style="border-bottom:2px solid #578429;">
<br/>
<a href="#"><span class="kczx_text01">您的位置：首页>案例库>详情</span> </a>
</div>


<div class="zyzx_more_divt"> 

<div class="zyzx_more_left">
 <div style="width:98%;height:auto;margin-top:20px;">
 <div style="font-size:16px;font-weight:bold;margin-bottom:20px;">
 
 ${caseDetail.tilte} </div> 
 
  <div style="width:100%;height:auto;text-align:left;margin-bottom:30px;">
 
<span style="font-weight:bold">访者信息：</span><br/>
李某，男，26岁，工人，汉族，已婚。<br/>
<span style="font-weight:bold">来访者主述:</span><br/> 
${caseDetail.case_visitor_say_c}
 <br/>
<span style="font-weight:bold">咨询目标与治理方法：</span><br/> 
${caseDetail.case_handle_content_c} <br/>
<span style="font-weight:bold">治疗结果：</span><br/> 
 ${caseDetail.case_cure_result_c} 
 ${caseDetail.case_id}
 </div>
 
 <div style="width:100%;height:auto;text-align:left">
 <img src="${imgpath}/images/zyzx_images/xing.png"/> 
 <span style="margin-right:20px;margin-left:20px;">上传人：${caseDetail.user_rnm}</span>
 <span style="margin-right:20px;">上传于：：${caseDetail.create_dt}</span>
 <span style="margin-right:20px;">浏览：${caseDetail.case_viewcnt}</span>
 
 </div>
 
 </div>

<div class="zyzx_more_tab1">


  
 </div>
 
 
 


<div style="width:100%;height:auto;display:block;overflow:hidden;padding:50px;">




<style type="text/css">
*{margin:0;padding:0;list-style-type:none;}
a,img{border:0;}
body{font:12px/180% Arial, Helvetica, sans-serif , "新宋体";}
/* sitelogo */
li{ list-style:none }
#sitelogo{position:relative;float:left;margin:5px auto;width:330px;height:30px;}
#sitelogo span{display:block;float:left;}
#sitelogo img{padding:2px;}
#sitelogo a:hover img{padding:2px;}
/* sitelogo ul */
#sitelogo ul{display:block;float:left;width:100px;height:28px;position:relative;background: url('${imgpath}/images/starrating.gif') top left repeat-x;}
#sitelogo ul li{float:left;}
#sitelogo ul li a{display:block;width:10px;height:28px;text-indent:-9000px;z-index:20;position:absolute;overflow:hidden;}
#sitelogo ul li a:hover{background:url('images/starrating.gif') left 35px;z-index:2;left:0;}
#sitelogo ul a.star1{left:0px;}
#sitelogo ul a.star1:hover{width:10px;}
#sitelogo ul a.star2{left:10px;}
#sitelogo ul a.star2:hover{width:20px;}
#sitelogo ul a.star3{left:20px;}
#sitelogo ul a.star3:hover{width:30px;}
#sitelogo ul a.star4{left:30px;}
#sitelogo ul a.star4:hover{width:40px;}
#sitelogo ul a.star5{left:40px;}
#sitelogo ul a.star5:hover{width:50px;}
#sitelogo ul a.star6{left:50px;}
#sitelogo ul a.star6:hover{width:60px;}
#sitelogo ul a.star7{left:60px;}
#sitelogo ul a.star7:hover{width:70px;}
#sitelogo ul a.star8{left:70px;}
#sitelogo ul a.star8:hover{width:80px;}
#sitelogo ul a.star9{left:80px;}
#sitelogo ul a.star9:hover{width:90px;}
#sitelogo ul a.star10{left:90px;}
#sitelogo ul a.star10:hover{width:100px;}
#currentrating{background:url('images/starrating.gif') left bottom;position:absolute;height:21px;width:0;display:block;text-indent:-9000px;z-index:1;}
#sitelogo #pftip{position:absolute;left:168px;width:200px;color:#999;font-size:14px;}
#sitelogo #pfno{width:40px;color:green;font-family:Arial;font-weight:bold;font-size:14px;}
#sitelogo p{width:110px;float:left;color:#666;}
#sitelogo p span{font-family:Arial;font-style:italic;color:#f60;}
#sitelogo #pfshi{font-size:32px;line-height:28px;font-weight:bold;}
#sitelogo #pfge{font-size:18px;line-height:22px;}
#sitelogo p span.no{width:110px;clear:both;color:#666;font-style:normal;font-size:12px;}
</style>



<div id="sitelogo">
		
		<ul class="starrating">
			<li id="currentrating"></li>
			<li><a onMouseOver="infen(1)" onMouseOut="infen(0)" onclick="commentStarLevel(1);" class="star1">1</a></li>
			<li><a onMouseOver="infen(2)" onMouseOut="infen(0)" onclick="commentStarLevel(2);" class="star2">2</a></li>
			<li><a onMouseOver="infen(3)" onMouseOut="infen(0)" onclick="commentStarLevel(3);" class="star3">3</a></li>
			<li><a onMouseOver="infen(4)" onMouseOut="infen(0)" onclick="commentStarLevel(4);" class="star4">4</a></li>
			<li><a onMouseOver="infen(5)" onMouseOut="infen(0)" onclick="commentStarLevel(5);" class="star5">5</a></li>
			<li><a onMouseOver="infen(6)" onMouseOut="infen(0)" onclick="commentStarLevel(6);" class="star6">6</a></li>
			<li><a onMouseOver="infen(7)" onMouseOut="infen(0)" onclick="commentStarLevel(7);" class="star7">7</a></li>
			<li><a onMouseOver="infen(8)" onMouseOut="infen(0)" onclick="commentStarLevel(8);" class="star8">8</a></li>
			<li><a onMouseOver="infen(9)" onMouseOut="infen(0)" onclick="commentStarLevel(9);" class="star9">9</a></li>
			<li><a onMouseOver="infen(10)" onMouseOut="infen(0)" onclick="commentStarLevel(10);" class="star10">10</a></li>
		</ul>
		<span id="pftip"></span>
		<span id="pfno"></span>
		
</div>

<div class="tab301">
<input type="text" style="width:700px;height:100px;padding:0px;" id="comment_input"/>
<div class="tab302">
您还可以输入200字
<a href="javascript:void(0);" id="publish_comment_a"><img src="${imgpath}/images/kczx_son/pl01.jpg"/></a>
</div>
</div>

<div class="tab303">

<a href="#" onMouseDown="tab300(1,5);">
<div id="tab0301" class="tab30301">
全部
</div>
</a>

<a href="#" onMouseDown="tab300(2,5);" >
<div id="tab0302" class="tab30301" style="background-color:#E2EFFC;border:1px solid #E2EFFC">
好评
</div>
</a>

<a href="#" onMouseDown="tab300(3,5);">
<div id="tab0303" class="tab30301" style="background-color:#E2EFFC;border:1px solid #E2EFFC">
中评
</div>
</a>

<a href="#" onMouseDown="tab300(4,5);">
<div id="tab0304" class="tab30301" style="background-color:#E2EFFC;border:1px solid #E2EFFC">
差评
</div>
</a>

</div>




<div id="tab3001" class="tab300">
<!--  
<div class="tab30001">
<div class="tab30002">

<img src="${imgpath}/images/kczx_son/user02.jpg">

</div>

<div class="tab30003">

<div class="tab3040102">
<div class="tab3040103">
<a href="#"><span class="retext05">张飞红</span></a>给课程打了5分

<div class="tab304010301">
<a style="color:#2884b3;" onMouseDown="rep1(1,1000);" href="#">回复</a>
</div>
</div>


<div class="tab3040104">
老师讲得很好。

</div>

<div class="tab3040105">
2014/8/18&nbsp;11:40:40
</div>

</div>

<div class="tab305">
<div class="tab3050101">
<img src="${imgpath}/images/kczx_son/user03.jpg">
</div>

<div class="tab3050102">
<div class="tab3050103">
<a href="#"><span class="retext05">杨洋</span></a>回复
<a href="#"><span class="retext05">张飞红</span></a>

<div id="replay0101" class="tab305010301">
<a style="color:#2884b3;" onMouseDown="rep1(1,1000);" href="#">回复</a>
</div>
</div>


<div class="tab3050104">
老师讲得很好。

</div>

<div class="tab3050105">
2014/8/18&nbsp;11:40:40
</div>

</div>

</div>


<div class="tab305">
<div class="tab3050101">
<img src="${imgpath}/images/kczx_son/user04.jpg">
</div>

<div class="tab3050102">
<div class="tab3050103">
<a href="#"><span class="retext05">小明</span></a>回复
<a href="#"><span class="retext05">杨洋</span></a>

<div id="replay0101" class="tab305010301">
<a style="color:#2884b3;" onMouseDown="rep1(1,1000);" href="#">回复</a>
</div>
</div>


<div class="tab3050104">
老师讲得很好。

</div>

<div class="tab3050105">
2014/8/18&nbsp;11:40:40
</div>

</div>

</div>


<div id="replay11" class="tab30004">
<input type="text" style="width:590px;height:70px;padding:0px;">
<a href="#">
<div class="tab30005">
发&nbsp;表
</div>
</a>


</div>


</div>
</div>


<div class="tab30001">
<div class="tab30002">

<img src="${imgpath}/images/kczx_son/user02.jpg">

</div>

<div class="tab30003">

<div class="tab3040102">
<div class="tab3040103">

<a href="#"><span class="retext05">张飞红</span></a>给课程打了5分

<div class="tab304010301">
<a style="color:#2884b3;" onMouseDown="rep1(2,1000);" href="#">回复</a>
</div>
</div>


<div class="tab3040104">
老师讲得很好。

</div>

<div class="tab3040105">
2014/8/18&nbsp;11:40:40
</div>

</div>

</div>


<div id="replay12" class="tab30004">
<input type="text" style="width:590px;height:70px;padding:0px;">
<a href="#">
<div class="tab30005">
发&nbsp;表
</div>
</a>

</div>

</div>


<div class="tab30001">
<div class="tab30002">

<img src="${imgpath}/images/kczx_son/user02.jpg">

</div>

<div class="tab30003">

<div class="tab3040102">
<div class="tab3040103">

<a href="#"><span class="retext05">张飞红</span></a>给课程打了5分

<div class="tab304010301">
<a style="color:#2884b3;" onMouseDown="rep1(3,1000);" href="#">回复</a>
</div>
</div>


<div class="tab3040104">
老师讲得很好。

</div>

<div class="tab3040105">
2014/8/18&nbsp;11:40:40
</div>

</div>

</div>


<div id="replay13" class="tab30004">
<input type="text" style="width:590px;height:70px;padding:0px;">
<a href="#">
<div class="tab30005">
发&nbsp;表
</div>
</a>

</div>

</div>


<div class="tab30001">
<div class="tab30002">

<img src="${imgpath}/images/kczx_son/user02.jpg">

</div>

<div class="tab30003">

<div class="tab3040102">
<div class="tab3040103">

<a href="#"><span class="retext05">张飞红</span></a>给课程打了5分

<div class="tab304010301">
<a style="color:#2884b3;" onMouseDown="rep1(4,1000);" href="#">回复</a>
</div>
</div>


<div class="tab3040104">
老师讲得很好。

</div>

<div class="tab3040105">
2014/8/18&nbsp;11:40:40
</div>

</div>

</div>


<div id="replay14" class="tab30004">
<input type="text" style="width:590px;height:70px;padding:0px;">
<a href="#">
<div class="tab30005">
发&nbsp;表
</div>
</a>

</div>

</div>


-->

</div>




<div id="tab3002" class="tab300" style="display:none">
</div>


<div id="tab3003" class="tab300" style="display:none">
</div>


<div id="tab3004" class="tab300" style="display:none">
<!--  
<div class="tab30001">
<div class="tab30002">

<img src="images/kczx_son/user02.jpg">

</div>

<div class="tab30003">

<div class="tab3040102">
<div class="tab3040103">
<a href="#"><span class="retext05">张飞红</span></a>给课程打了5分

<div class="tab304010301">
<a style="color:#2884b3;" onMouseDown="rep4(1,1000);" href="#">回复</a>
</div>
</div>


<div class="tab3040104">
老师讲得很好。

</div>

<div class="tab3040105">
2014/8/18&nbsp;11:40:40
</div>

</div>

<div class="tab305">
<div class="tab3050101">
<img src="images/kczx_son/user03.jpg">
</div>

<div class="tab3050102">
<div class="tab3050103">
<a href="#"><span class="retext05">杨洋</span></a>回复
<a href="#"><span class="retext05">张飞红</span></a>

<div id="replay0101" class="tab305010301">
<a style="color:#2884b3;" onMouseDown="rep4(1,1000);" href="#">回复</a>
</div>
</div>


<div class="tab3050104">
老师讲得很好。

</div>

<div class="tab3050105">
2014/8/18&nbsp;11:40:40
</div>

</div>

</div>


<div class="tab305">
<div class="tab3050101">
<img src="images/kczx_son/user04.jpg">
</div>

<div class="tab3050102">
<div class="tab3050103">
<a href="#"><span class="retext05">小明</span></a>回复
<a href="#"><span class="retext05">杨洋</span></a>

<div id="replay0101" class="tab305010301">
<a style="color:#2884b3;" onMouseDown="rep4(1,1000);" href="#">回复</a>
</div>
</div>


<div class="tab3050104">
老师讲得很好。

</div>

<div class="tab3050105">
2014/8/18&nbsp;11:40:40
</div>

</div>

</div>


<div id="replay41" class="tab30004">
<input type="text" style="width:590px;height:70px;padding:0px;">
<a href="#">
<div class="tab30005">
发&nbsp;表
</div>
</a>


</div>


</div>
</div>


<div class="tab30001">
<div class="tab30002">

<img src="images/kczx_son/user02.jpg">

</div>

<div class="tab30003">

<div class="tab3040102">
<div class="tab3040103">

<a href="#"><span class="retext05">张飞红</span></a>给课程打了5分

<div class="tab304010301">
<a style="color:#2884b3;" onMouseDown="rep4(2,1000);" href="#">回复</a>
</div>
</div>


<div class="tab3040104">
老师讲得很好。

</div>

<div class="tab3040105">
2014/8/18&nbsp;11:40:40
</div>

</div>

</div>


<div id="replay42" class="tab30004">
<input type="text" style="width:590px;height:70px;padding:0px;">
<a href="#">
<div class="tab30005">
发&nbsp;表
</div>
</a>

</div>

</div>


<div class="tab30001">
<div class="tab30002">

<img src="images/kczx_son/user02.jpg">

</div>

<div class="tab30003">

<div class="tab3040102">
<div class="tab3040103">

<a href="#"><span class="retext05">张飞红</span></a>给课程打了5分

<div class="tab304010301">
<a style="color:#2884b3;" onMouseDown="rep4(3,1000);" href="#">回复</a>
</div>
</div>


<div class="tab3040104">
老师讲得很好。

</div>

<div class="tab3040105">
2014/8/18&nbsp;11:40:40
</div>

</div>

</div>


<div id="replay43" class="tab30004">
<input type="text" style="width:590px;height:70px;padding:0px;">
<a href="#">
<div class="tab30005">
发&nbsp;表
</div>
</a>

</div>

</div>
-->

  
</div>



</div>

  

  

 



  
</div>


  


  <div class="zyzx_div_right">

	   <a href="../study_platform/study_platform/my_caseaddec.htm">
	      <div class="alxx_div_righttb" style="font-size:14px;font-weight:blod;color:#111"> 分&nbsp;享&nbsp;案&nbsp;例</div>
	   </a>
	   <div class="zyzx_div_rightt">
		    <div class="alxx_div_righttbt">
		     <span class="alxx_div_righttl" > 案例分享达人</span>
		     <a href="javascript:void(0);" onClick="expertNext();"><span class="alxx_div_righttr"> 换一批</span></a>
		    </div>
		   
		     <div id="fxtab01" style="width:100%;height:auto;display:block;">
		  					<table style="width:230px;" id="share_expert_table">
								<c:forEach items="${shareExpertList}" var="item">
									<tr height="70px">
										<td width="60px"> <a href="#"><img src="${cdrmFilePath}/${item.user_himg}?w=50&h=50" ></a> </td>
										<td  valign="top"> <a href="#" >
											<p class="retext05">${item.user_lnm} </p>
											</a> 综合积分：${item.user_integral} </td>
									</tr>
								</c:forEach>
							</table>
		     </div>
	  </div>
  </div>
 </div>

</div>


       <%@ include file="./footer.jsp"%>


<script type="text/javascript">
Date.prototype.format =function(format)
{
var o = {
"M+" : this.getMonth()+1, //month
"d+" : this.getDate(), //day
"h+" : this.getHours(), //hour
"m+" : this.getMinutes(), //minute
"s+" : this.getSeconds(), //second
"q+" : Math.floor((this.getMonth()+3)/3), //quarter
"S" : this.getMilliseconds() //millisecond
}
if(/(y+)/.test(format)) format=format.replace(RegExp.$1,
(this.getFullYear()+"").substr(4- RegExp.$1.length));
for(var k in o)if(new RegExp("("+ k +")").test(format))
format = format.replace(RegExp.$1,
RegExp.$1.length==1? o[k] :
("00"+ o[k]).substr((""+ o[k]).length));
return format;
}

var globalVar = {
	expertPageNum : 1,
	expertHasNext : null,
	resource_id : '',
	resource_name : '',
	currentScore : 0,
	allCommentDiv : null,
	goodCommentDiv : null,
	middleCommentDiv : null,
	negativeCommentDiv : null
};
$(function(){
	globalVar.expertHasNext = '${shareExpertNext}';
	globalVar.resource_id = '${caseDetail.case_id}';
	//globalVar.resource_name = '${resource.file_name}';
	globalVar.allCommentDiv = $('#tab3001');
	globalVar.goodCommentDiv = $('#tab3002');
	globalVar.middleCommentDiv = $('#tab3003');
	globalVar.negativeCommentDiv = $('#tab3004');
	//globalVar.expertPageNum = 1;
	loadComments();
	$.ajax({
		 url : '/case/resource/resourceViewAjax/${caseDetail.case_id}',
      	 dataType : 'text',
      	 success : function(d,status){},
      	 error : function(d){}
	});
	/*$('#d_r_now').click(function(){
		downResource();
	});*/
	$('#publish_comment_a').click(function(){
		publishComment();
	});
});
function commentStarLevel(level){
	globalVar.currentScore = level;
	alert(globalVar.currentScore);
}
function publishComment(){
	var $comment = $('#comment_input');
	var commentText = $comment.val();
	$.ajax({
		 url : '/case/resource/getHeadImg/0/null',
		 type : 'post',
 	   	 dataType : 'json',
 	   	 success : function(d,status){
 	   		 var data = {
 	   			 referenceId : "${caseDetail.case_id}",
 				 content : commentText,
 				 author : {"identity":d.uid, "name":d.uname},
 				 commentType : 'case_study',
 				 score : globalVar.currentScore
 			 };
 	   		doPublishComment(data,d.himg);
 	   	 },
 	   	 error : function(d){}
	});	
}
//执行发布评论
function doPublishComment(data,himg){
	alert(JSON.stringify(data));
	console.log(JSON.stringify(data));
	$.ajax({
		 url : '/api/v1/comment',
		 type : 'post',
		 contentType : 'application/json',
		 headers: {
            "Accept" : "text/plain; charset=utf-8",
            "Content-Type": "application/json; charset=utf-8"
        },
        data : JSON.stringify(data),
	   	 //dataType : 'json',
	   	 success : function(d,status){
	   		 //alert(d);
	   		 $('#comment_input').val('');
	   		 var commentData = {
	   			_id : d,
	   			author : {"identity": data.author.identity,"name": data.author.name},
	   			content : data.content,
	   			score : data.score,
	   			createTime : {$date:new Date().format('yyyy-MM-dd hh::mm::ss')}
	   		 };
	   		appendComment(commentData,true,himg);
	   		//appendComment(d,data.author.identity,data.author.name,himg,data.score,data.content,new Date().format('yyyy-MM-dd hh::mm::ss'),true,null);
	   	 },
   	 	error : function(d){}
	});
}
//往评论列表增加评论
function appendComment(commentData,first,authorHImg){
	var _id = commentData._id;
	var authorid= commentData.author.identity;
	var authorName = commentData.author.name;
	var score = commentData.score;
	var html = '<div class="tab30001" name="commentContainer-'+_id+'">'+
			'<div class="tab30002"> <img src="${image.server}/images/user02.jpg" name="headImg-'+_id+'"> </div>'+
		 	'<div class="tab30003">'+
			'<div class="tab3040102">'+
				'<div class="tab3040103"> <a href="#"><span class="retext05">'+commentData.author.name+'</span></a>给课程打了'+commentData.score+'分'+
					'<div class="tab304010301"> <a href="javascript:void(0);" name="replyBut-'+_id+'" style="color:#2884b3;">回复</a> </div>'+
				'</div>'+
				'<div class="tab3040104"> '+commentData.content+'</div>'+
				'<div class="tab3040105"> '+commentData.createTime.$date+' </div>'+
			'</div></div></div>';
	 if(first) globalVar.allCommentDiv.prepend(html); else globalVar.allCommentDiv.append(html);
	 globalVar.allCommentDiv.find('a[name=replyBut-'+_id+']').click(function(){ replyCommentEvent(1,_id,_id,authorid,authorName);  });
	 fillReplyComments(1,_id,commentData.comments);
	 
	 //根据score判断插入的div
	 if(score <= 2){//差评
		 if(first) globalVar.negativeCommentDiv.prepend(html); else globalVar.negativeCommentDiv.append(html);
		 globalVar.negativeCommentDiv.find('a[name=replyBut-'+_id+']').click(function(){ replyCommentEvent(2,_id,_id,authorid,authorName);  });
	 } else if(score >2 && score <= 6){//中评
		 if(first) globalVar.middleCommentDiv.prepend(html); else globalVar.middleCommentDiv.append(html);
		 globalVar.middleCommentDiv.find('a[name=replyBut-'+_id+']').click(function(){ replyCommentEvent(3,_id,_id,authorid,authorName);  });
	 } else if(score >6 && score <= 10){//好评
		 if(first) globalVar.goodCommentDiv.prepend(html); else globalVar.goodCommentDiv.append(html);
		 globalVar.goodCommentDiv.find('a[name=replyBut-'+_id+']').click(function(){ replyCommentEvent(4,_id,_id,authorid,authorName);  });
	 }
	if(authorHImg != null && authorHImg != ''){
		$('img[name=headImg-'+_id+']').attr('src','${cdrmFilePath}/'+authorHImg+'?w=50&h=50');
	} else {
		$.ajax({
			 url : '/case/resource/getHeadImg/'+authorid+'/'+_id,
			 type : 'post',
	  	   	 dataType : 'json',
	  	   	 success : function(d,status){
	  	   		 //alert('get head'+d.himg);
	  	   		 if(d.himg != ''){
	  	   		$('img[name=headImg-'+d.comment_id+']').attr('src','${cdrmFilePath}/'+d.himg+'?w=50&h=50');
	  	   		 }
	  	   	 },
	  	   	 error : function(d){}
		});
	}
}
//填充回复的评论列表 （对评论的回复再回复）
function fillReplyComments(type,_id,replyComments){
	var $container = getPanelDivByType(type);
	var $commentDiv = $container.find('div[name=commentContainer-'+_id+'] .tab30003');
	//alert('1' == 1);
	if(replyComments){
		$.each(replyComments,function(i,item){
			$commentDiv.append('<div class="tab305">'+
							'<div class="tab3050101"> <img src="${image.server}/images/user02.jpg" name="headImg-'+item._id+'"> </div>'+
							'<div class="tab3050102">'+
								'<div class="tab3050103"> <a href="#"><span class="retext05">'+item.author.name+'</span></a>回复 <a href="#"><span class="retext05">'+item.object.name+'</span></a>'+
									'<div class="tab305010301"> <a href="javascript:void(0);" onclick="replyCommentEvent(\''+type+'\',\''+_id+'\',\''+item._id+'\',\''+item.author.identity+'\',\''+item.author.name+'\')" name="replyBut-'+item._id+'" style="color:#2884b3;">回复</a> </div>'+
								'</div>'+
								'<div class="tab3050104">'+item.content+'</div>'+
								'<div class="tab3050105">'+item.createTime.$date+'</div>'+
							'</div>'+
						'</div>');
			$.ajax({
				 url : '/case/resource/getHeadImg/'+item.author.identity+'/'+item._id,
				 type : 'post',
		  	   	 dataType : 'json',
		  	   	 success : function(d,status){
		  	   		 //alert('get head'+d.himg);
		  	   		 if(d.himg != ''){
		  	   			$('img[name=headImg-'+d.comment_id+']').attr('src','${cdrmFilePath}/'+d.himg+'?w=50&h=50');
		  	   		 }
		  	   	 },
		  	   	 error : function(d){}
			});
		});
	}
}
// 加载评论列表
function loadComments(){
	$.ajax({
		 url : '/api/v1/comment/host/${caseDetail.case_id}?type=case_study',
		 type : 'get',
	   	 success : function(d,status){
	   		 //alert(d);
	   		 var data = $.parseJSON(d);
	   		 //var html = [];
	   		 $.each(data,function(i,item){
	   			//appendComment(item._id,item.author.identity,item.author.name,null,item.score,item.content,item.createTime.$date,false,item.comments);
	   			appendComment(item,false,null);
	   		 });
	   		 //$('#tab3001').append(html.join(''));
	   	 },
	   	 error : function(d){}
	});
}
//根据type得到页签
function getPanelDivByType(type){
	var $container;
	if(type == 1) $container=globalVar.allCommentDiv;
	else if(type == 2) $container=globalVar.goodCommentDiv;
	else if(type == 3) $container=globalVar.middleCommentDiv;
	else if(type == 4) $container=globalVar.negativeCommentDiv;
	return $container;
}
//回复点击事件
function replyCommentEvent(type,hostid,_id,authorid,authorName){
	//alert('replyCommentEvent');
	var $container = getPanelDivByType(type);	
	var $replyDiv = $container.find('[name=replyDiv-'+_id+']');
	/*if($replyDiv.length > 0){
		$replyDiv.each(function(){
		  $(this).val("");
		 });
		$replyDiv.show();
	} else */
	if($replyDiv.length < 1){
		$container.find('[name=commentContainer-'+hostid+']').append('<div class="tab30004" name="replyDiv-'+_id+'" style="display:block">'+
					'<input type="text" style="width:590px;height:70px;padding:0px;" id="replyInput-'+_id+'">'+
					'<a href="javascript:void(0);" onclick="doReplyComment(\''+type+'\',\''+hostid+'\',\''+_id+'\',\''+authorid+'\',\''+authorName+'\')" name="replyBut-'+_id+'">'+
					'<div class="tab30005"> 发&nbsp;表 </div>'+
					'</a> </div>');
		var $inputs = $("div[name^='replyDiv-'][name!=replyDiv-"+_id+"]");
		//alert($inputs.length);
		$inputs.remove();
	}
}
function doReplyComment(type,hostid,_id,authorid,authorName){	 
	var $input = $('#replyInput-'+_id);
	var commentText = $input.val();
	$.ajax({
		 url : '/case/resource/getHeadImg/0/null',
		 type : 'post',
	   	 dataType : 'json',
	   	 success : function(d,status){
	   		 //alert(JSON.stringify(d));
	   		 var data = {
	   			 referenceId : hostid,
				 content : commentText,
				 author : {"identity":d.uid, "name":d.uname},
				 commentType : 'case_study',
				 object : {"identity":authorid, "name":authorName}
			  };
	   		 //alert(data.author.identity);
	   		 var replyAuthorName = d.uname;
	   		 var replyAuthorId = d.uid;
	   		 var replyHImg = d.himg;
	   		 $.ajax({
		   		 url : '/api/v1/comment',
		   		 type : 'post',
		   		 contentType : 'application/json',
		   		 headers: {
		               "Accept" : "text/plain; charset=utf-8",
		               "Content-Type": "application/json; charset=utf-8"
		           },
		   		 data : JSON.stringify(data),
		      	 //dataType : 'json',
		      	 success : function(d,status){
		      		// alert('success:'+d);
		      		var $replyDiv = $('div[name=replyDiv-'+_id+']');
		      		showReply(type,authorName,replyAuthorId,replyAuthorName,commentText,hostid,d,replyHImg);
		      		//$input.remove();
		      		$replyDiv.remove();
		      		 //var data = JSON.parseJSON(d);
		      	 },
		      	 error : function(d){}
		   	});
	   	 },
	   	 error : function(d){}
	});	
}
function showReply(type,author,replyAuthorId,reviewer,content,hostid,_id,himg){
	var $container = getPanelDivByType(type);
	var html='<div class="tab305">'
			+'	<div class="tab3050101"> <img src="${cdrmFilePath}/'+himg+'?w=50&h=50'+'"> </div>'
			+'	<div class="tab3050102">'
			+'		<div class="tab3050103"> <a href="#"><span class="retext05">'+reviewer+'</span></a>回复 <a href="#"><span class="retext05">'+author+'</span></a>'
			+'			<div  class="tab305010301"> <a style="color:#2884b3;" onclick="replyCommentEvent(\''+type+'\',\''+hostid+'\',\''+_id+'\',\''+replyAuthorId+'\',\''+reviewer+'\')" name="replyBut-'+_id+'">回复</a> </div>'
			+'		</div>'
				+'	<div class="tab3050104"> '+content+' </div>'
			+'		<div class="tab3050105">'+ new Date().format('yyyy-MM-dd hh:mm:ss');+' </div>'
			+'	</div>'
		+'	</div>';
	//$('[name='+namediv+']').append(html); 
	var $tmp = $container.find('div.tab30003');
	$tmp.append(html);
	//$container.find('div[name=commentContainer-'+hostid+'] .tab30003').append(html);
}
//下载资源
/*function downResource(){
	$.ajax({
		 url : '/share/resource/valid_integral/'+globalVar.resource_id,
     	 dataType : 'json',
     	 success : function(d,status){
     		 if(d.can){
     			 window.open("/drmdown/${resource.file_id}?fnm="+globalVar.resource_name);
     		 } else {
     			 alert(d.msg);
     		 }
     	 },
     	 error : function(d){}
	});
}*/
function expertNext(){
	//alert(globalVar.expertHasNext);
	var $table = $('#share_expert_table');
	if(globalVar.expertHasNext == 'true'){
		$.ajax({
			 url : '/case/resource/expertListAjax/'+(globalVar.expertPageNum + 1),
	       	 dataType : 'json',
	       	 success : function(d,status){
	       		 var html = [];
	       		 $.each(d.shareExpertList,function(i,item){
	       			html.push('<tr height="70px">'+
	       					'<td width="60px"> <a href="#"><img src="${cdrmFilePath}/'+item.user_himg+'?w=50&h=50" ></a> </td>'+
	       					'<td  valign="top"> <a href="#" ><p class="retext05">'+item.user_lnm+'</p></a> 综合积分：'+item.user_integral+' </td></tr>');
	       		 });
	       		 //alert(html.join(''));
	       		$table.html(html.join(''));
	       		globalVar.expertPageNum ++;
	       		 //alert(d.shareExpertNext);
	       		 globalVar.expertHasNext = d.shareExpertNext;
	       	 },
	       	 error : function(d){
	       		 alert('请求出错！');
	       	 }
		});
	} else {
		$table.html('无更多数据');
	}
}
function testReply(){
	var data = {
  			 referenceId : "${resource.share_file_id}",
			 content : "sssssSSSSSSS",
			 author : {"identity":"1920209339393939393", "name":"name"},
			 commentType : 'case_study',
			 object : {"identity":"23644eb8-ed19-4c65-b8d8-827c26241efd", "name":"ddddddddd"}
		 };
  		$.ajax({
	   		 url : '/api/v1/comment',
	   		 type : 'post',
	   		 contentType : 'application/json',
	   		 headers: {
	               "Accept" : "text/plain; charset=utf-8",
	               "Content-Type": "application/json; charset=utf-8"
	           },  
	   		 data : JSON.stringify(data),
	      	 //dataType : 'json',
	      	 success : function(d,status){
	      		 alert('success:'+d);
	      		 //$('#replyDiv-'+_id).hide();
	      		 var data = JSON.parseJSON(d);
          alert(data);
	      	 },
	      	 error : function(d){}
	   	});

}
</script>
</body>
</html>
